package com.hhl.flower.controller;

import com.hhl.flower.common.result.Result;
import com.hhl.flower.pojo.entity.Type;
import com.hhl.flower.service.TypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user/type")
@Api(tags = "分类相关接口")
@Slf4j
public class TypeController {

	@Autowired
	private TypeService typeService;

	@GetMapping("/list")
	@ApiOperation("获取分类列表")
	public Result<List<Type>> list() {

		List<Type> typeList = typeService.list();

		return Result.success(typeList);
	}
}
